home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PAS_0793 / ROLLCURS.PAS < prev    next >
Pascal/Delphi Source File  |  1993-08-01  |  2KB  |  71 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 157 of 158                                                               
  3. From : Herb Brown                          1:396/15.6           19 Jul 93  01:52 
  4. To   : Paul Staton                                                               
  5. Subj : source code                                                            
  6. ────────────────────────────────────────────────────────────────────────────────
  7. In a msg on <Jul 18 17:58>, Paul Staton of 1:124/5147 writes:
  8.  
  9.  PS> Does anyone have some source to make a scrolling completion bar 
  10.  PS> such as  the ones found in most install programs for store 
  11.  PS> bought programs.  I will be read the total conferance areas 
  12.  
  13. Here is one I whipped up for rolling the cursor and shows the bar of
  14. completion..
  15.  
  16. (tested and YES, people it needs optimization!!!!!)
  17. ( And I know, I know, my style SUCKS!! ;-)}
  18. program RollCurs;
  19.  
  20. {produces a "rolling cursor" and shows various ways of producing
  21.    a report of "percent of completion"}
  22.  
  23. uses dos, Opcrt; { Opro used to turn cursor off and on }
  24. const Work : array[1..4] of char =
  25.              ('\','|','/','-');   { Rolling cursor characters }
  26.       x : integer = 1;
  27.     MaxLoop : Integer = 10000; { Just to compute something ...}
  28.  
  29. var i :integer;
  30.     Bar : string;
  31.     p10,p20,p30,p40,p50,p60,p70,p80,p90,p100 : Integer;
  32. begin
  33. bar:='';
  34. HiddenCursor;
  35. clrscr;
  36. for i:=1 to MaxLoop do
  37. begin
  38. x:=(x mod 4)+1; { Index new element in array }
  39. write('running...',work[x],' ',round((i / MaxLoop)*100),' ','%',#13);
  40. delay(20);
  41. end;
  42. writeln;
  43. writeln('           [1234567890] Percentage Completed - In multiples of 10');
  44. p10:= round((10*(1/100))*maxLoop); { get the percents of the value }
  45. p20:= round((20*(1/100))*maxLoop);
  46. p30:= round((30*(1/100))*maxLoop);
  47. p40:= round((40*(1/100))*maxLoop);
  48. p50:= round((50*(1/100))*maxLoop);
  49. p60:= round((60*(1/100))*maxLoop);
  50. p70:= round((70*(1/100))*maxLoop);
  51. p80:= round((80*(1/100))*maxLoop);
  52. p90:= round((90*(1/100))*maxLoop);
  53. p100:=round((100*(1/100))*MaxLoop);
  54. for i:=1 to MaxLoop do
  55. begin
  56. if (i=p10)
  57. or (i=p20)
  58. or (i=p30)
  59. or (i=p40)
  60. or (i=p50)
  61. or (i=p60)
  62. or (i=p70)
  63. or (i=p80)
  64. or (i=p90)
  65. or (i=p100) then bar:=bar+#176;
  66. x:=(x mod 4)+1; { Index new element in array }
  67. write('running...',work[x],' ',Bar,#13);
  68. delay(20);
  69. end;
  70. NormalCursor;
  71. end.